#include "Sprite.h"
//---------------------------------------------------------------------------------------------//
Sprite::Sprite()
: m_pTexture(new Texture)
{
	m_pVertices = new D3DVertexUV[4];
	
	m_pVertices[0].SetVertex(-64,64,0,0,0);
	m_pVertices[1].SetVertex(64,64,0,1,0);
	m_pVertices[2].SetVertex(-64,-64,0,0,1);
	m_pVertices[3].SetVertex(64,-64,0,1,1);
}
//---------------------------------------------------------------------------------------------//
void Sprite::Init(Graphics &g)
{
	m_pTexture = g.LoadTexture(L"Textures/wonderboy.bmp",0xffff00ff);
	m_animation = new Animation(m_pVertices,m_pTexture,48,48,10);
}
//---------------------------------------------------------------------------------------------//
void Sprite::Draw(Graphics &g)
{
	g.SetMatrixMode(WORLD_MATRIX);
	g.LoadIdentity();
	g.SetTexture(m_pTexture);
	m_animation->AnimateSprite(50);
	//g.DrawSpriteElements(4,m_pVertices,TRIANGLESTRIP);
}